#include "SwitchButton.h"

namespace TWCore
{

	SwitchButton::SwitchButton(QWidget *parent) :
		QPushButton(parent)
	{
		setObjectName("switchButton");
		setCheckable(true);
		setFocusPolicy(Qt::NoFocus);
		countLabel.setParent(this);
		countLabel.setObjectName("bubble");
		countLabel.setAlignment(Qt::AlignCenter);
		countLabel.hide();
		show();
	}

	void SwitchButton::setWarningCount(const QString& hint)
	{
		if(hint.isEmpty())
			countLabel.hide();
		else
		{
			countLabel.move(width()-countLabel.width(),countLabel.y());
			countLabel.setText(hint);
			countLabel.show();
		}
	}

} // namespace TWCore
